import { request } from './request'
import type { Case, PaginatedResponse } from '@/types'

// 获取案例列表
export const getCases = (params: {
  page: number
  page_size: number
  industry?: string
  status?: number
}) => {
  return request<PaginatedResponse<Case>>({
    url: '/admin/cases',
    method: 'get',
    params
  })
}

// 获取案例详情
export const getCase = (id: number) => {
  return request<Case>({
    url: `/admin/cases/${id}`,
    method: 'get'
  })
}

// 创建案例
export const createCase = (data: Partial<Case>) => {
  return request<Case>({
    url: '/admin/cases',
    method: 'post',
    data
  })
}

// 更新案例
export const updateCase = (id: number, data: Partial<Case>) => {
  return request<Case>({
    url: `/admin/cases/${id}`,
    method: 'put',
    data
  })
}

// 删除案例
export const deleteCase = (id: number) => {
  return request({
    url: `/admin/cases/${id}`,
    method: 'delete'
  })
}

